<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>画椭圆弧</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.imagearc" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imagearc</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">imagearc</span> &mdash; <span class="dc-title">画椭圆弧</span></p>

 </div>
 <div class="refsect1 unknown-seealsp" id="refsect1-function.imagearc-unknown-seealsp">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imagearc</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$image</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$cx</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$cy</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$w</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$h</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$s</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$e</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$color</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>imagearc()</strong></span> 以
   <code class="parameter">cx</code>，<code class="parameter">cy</code>（图像左上角为 0, 0）为中心在
   <code class="parameter">image</code> 所代表的图像中画一个椭圆弧。<code class="parameter">w</code>
   和 <code class="parameter">h</code> 分别指定了椭圆的宽度和高度，起始和结束点以
   <code class="parameter">s</code> 和 <code class="parameter">e</code>
   参数以角度指定。0°位于三点钟位置，以顺时针方向绘画。
  </p>
  <div class="example" id="example-3657">
   <p><strong>Example #1 用 <span class="function"><strong>imagearc()</strong></span> 画一个圆</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;创建一个&nbsp;200X200&nbsp;的图像<br /></span><span style="color: #0000BB">$img&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatetruecolor</span><span style="color: #007700">(</span><span style="color: #0000BB">200</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">200</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;分配颜色<br /></span><span style="color: #0000BB">$white&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$img</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$black&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$img</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;画一个黑色的圆<br /></span><span style="color: #0000BB">imagearc</span><span style="color: #007700">(</span><span style="color: #0000BB">$img</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">150</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">150</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">360</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$black</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;将图像输出到浏览器<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Content-type:&nbsp;image/png"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imagepng</span><span style="color: #007700">(</span><span style="color: #0000BB">$img</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;释放内存<br /></span><span style="color: #0000BB">imagedestroy</span><span style="color: #007700">(</span><span style="color: #0000BB">$img</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
   </div>

  </div>
  <p class="para">
   参见 <span class="function"><a href="imageellipse.html" class="function">imageellipse()</a></span>，<span class="function"><a href="imagefilledellipse.html" class="function">imagefilledellipse()</a></span>
   和 <span class="function"><a href="imagefilledarc.html" class="function">imagefilledarc()</a></span>。
  </p>
 </div>

</div></div></div></body></html>